package trees;


public class ListNode {
    int val;
    ListNode next;

    private ListNode() {
    }

    public ListNode(int val) {
        this.val = val;
    }

    public ListNode(int val, ListNode next) {
        this.val = val;
        this.next = next;
    }

    public static void add(int val, ListNode node) {
        while (node.next != null) {
            node = node.next;
        }

        node.next = new ListNode(val);
    }
}
